//
//  YBTransferViewController+LayoutConstraints.m
//  Nectar
//
//  Created by famer on 2023/11/12.
//  Copyright © 2023 asance. All rights reserved.
//

#import "YBTransferViewController+LayoutConstraints.h"

@implementation YBTransferViewController (LayoutConstraints)
- (void)setLayoutConstraints{
    CGFloat width = self.view.size.width;
    CGFloat height = self.view.size.height;
    CGFloat leftMargin = 12;
    CGFloat topMargin = 16;
    
    self.navigationBar.frame = CGRectMake(0,  [UIView statusBarHeight], width, 64);
    
    self.contentView.frame = CGRectMake(0,
                                        self.navigationBar.bottom,
                                        width,
                                        self.view.height-self.navigationBar.bottom);
    
    CGFloat rowWidth = self.contentView.width - leftMargin*2;
    CGFloat rowLeftMargin = 16;
    
    CGSize toLabelSize = [self.toLabel textBoundingSizeWithMaxSize:CGSizeMake(rowWidth, 500)];
    self.toLabel.frame = CGRectMake(leftMargin,
                                    20,
                                    rowWidth,
                                    toLabelSize.height);
    
    self.addressContentView.frame = CGRectMake(leftMargin,
                                               self.toLabel.bottom+8,
                                               rowWidth,
                                               60);
    
    CGFloat addressImageWidth = 20;
    self.addressImageView.frame = CGRectMake(self.addressContentView.width-addressImageWidth-rowLeftMargin,
                                             0,
                                             addressImageWidth,
                                             addressImageWidth);
    
    self.addressImageView.centerY = self.addressContentView.height*0.5;
    
    self.addressTextField.frame = CGRectMake(rowLeftMargin,
                                             0,
                                             self.addressImageView.left-rowLeftMargin,
                                             self.addressContentView.height);
    
    ///
    self.amountLabel.frame = CGRectMake(leftMargin,
                                        self.addressContentView.bottom+26,
                                        rowWidth,
                                        self.toLabel.height);
    
    self.balanceLabel.frame = CGRectMake(leftMargin,
                                        self.addressContentView.bottom+26,
                                        rowWidth-leftMargin,
                                        self.toLabel.height);
    
    self.amountContentView.frame = CGRectMake(leftMargin,
                                              self.amountLabel.bottom+8,
                                              rowWidth,
                                              0);
    
    self.amountField.frame = CGRectMake(rowLeftMargin,
                                        0,
                                        rowWidth-rowLeftMargin*2,
                                        74);
    
    self.amountLineView.frame = CGRectMake(0, self.amountField.bottom, rowWidth, 1);
    
    self.memoLabel.frame = CGRectMake(rowLeftMargin,
                                      self.amountLineView.bottom+8,
                                      self.amountField.width,
                                      40);
    
    self.amountContentView.height = self.memoLabel.bottom+10;
    
    ///
    self.nextStepView.frame = CGRectMake(leftMargin, self.amountContentView.bottom+46, rowWidth, 50);
}
@end
